package androidcamp.socialfitnesstracker.data;

import androidcamp.socialfitnesstracker.util.TimeInterval;

import java.io.Serializable;

public class Goal implements Serializable {
    
    private WorkoutType type;
    private long timeToSpend; // in seconds
    private int interval;
    private TimeUnit intervalUnit;

    public Goal(WorkoutType type, long timeToSpend, int interval, TimeUnit intervalUnit) {
        this.type = type;
        this.timeToSpend = timeToSpend;
        this.interval = interval;
        this.intervalUnit = intervalUnit;
    }

    public WorkoutType getType() {
        return type;
    }

    public long getTimeToSpend() {
        return timeToSpend;
    }

    public int getInterval() {
        return interval;
    }

    public TimeUnit getIntervalUnit() {
        return intervalUnit;
    }
    
    public String toString() {
        return String.format("Spend %s %s every %d %s",
                new TimeInterval(timeToSpend).getHumanFormat(),
                type.getActivityName(), interval,
                interval == 1 ? intervalUnit.getSingular() : intervalUnit.getPlural());
    }

}
